package com.wtpaint.lib.glide.load.model;


import com.wtpaint.lib.glide.cache.Key;
import com.wtpaint.lib.glide.load.model.data.DataFetcher;

public interface ModelLoader<Model, Data> {

     interface ModelLoaderFactory<Model, Data> {
        ModelLoader<Model, Data> build(ModelLoaderRegistry registry);
    }

    class LoadData<Data> {

        private final Key key;
        //加载的数据
        private final DataFetcher<Data> fetcher;

        public LoadData(Key key, DataFetcher<Data> fetcher) {
            this.key = key;
            this.fetcher = fetcher;
        }
    }

    /**
     * 当前Loader是否能够处理对应的model数据
     *
     * @param mode
     * @return
     */
    boolean handles(Model mode);


    LoadData<Data> buildData(Model model);
}
